cmake_minimum_required(VERSION 3.10)
# project information
project(mycode-lib-w25q256)

#设置交叉编译器
if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch")
    set(CMAKE_C_COMPILER gcc)
else (CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
    set(CMAKE_C_COMPILER "/opt/compiler/bin/aarch64-linux-gnu-gcc")
endif()

# Header path
include_directories(
    ../../include/
)

SET(LIBRARY_OUTPUT_PATH "../lib")           #设置库文件的输出目
add_library(w25q256 SHARED w25q256.c)

target_link_libraries(w25q256)

install(TARGETS w25q256 DESTINATION ${LIBRARY_OUTPUT_PATH})
